package com.module.aichat.data.protocol

import androidx.room.ColumnInfo
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.beust.klaxon.TypeFor
import com.module.aichat.data.protocol.messageContent.MessageContent
import com.module.aichat.db.converter.ContentConverter

/**
 * 作者：sosou
 * <p>
 * 版本：1.0
 * <p>
 * 创建日期：2025/6/30
 * <p>
 * 描述：消息基类
 * <p>
 * 修订历史：
 */
open class Message {
    //本地消息的ID，用于APP数据库的消息ID
    @ColumnInfo(name = "id")
    @PrimaryKey
    var id: String = ""

    //消息的类型
    @TypeFor(field = "content", adapter = MessageContentTypeAdapter::class)
    @ColumnInfo(name = "type")
    var type: String? = ""

    //协议版本号
    @ColumnInfo(name = "version")
    var version: String? = ""

    //发送时间
    @ColumnInfo(name = "sendTime")
    var sendTime: Long = 0L
    //
    @ColumnInfo(name = "taskId")
    var taskId: String? = ""
    //
    @ColumnInfo(name = "messageId")
    var messageId: String? = ""
    //
    @ColumnInfo(name = "conversationId")
    var conversationId: String? = ""

    //消息ID
    @ColumnInfo(name = "targetId")
    var targetId: String? = ""

    //发送者ID
    @ColumnInfo(name = "senderId")
    var senderId: String? = ""

    //消息状态0等待中1完成2错误
    @ColumnInfo(name = "sendStatus")
    var sendStatus: Int = 0

    //扩展字段
    @ColumnInfo(name = "extra")
    var extra: String? = ""

    //具体的消息结构体
    @TypeConverters(ContentConverter::class)
    @ColumnInfo(name = "content")
    var content: MessageContent? = null

    //点赞状态
    @ColumnInfo(name = "likeStatus")
    var likeStatus: Int = 0

    //褒贬状态
    @ColumnInfo(name = "fallStatus")
    var fallStatus: Int = 0

}